/**
 * Definition for a binary tree node.
 * function TreeNode(val) {
 *     this.val = val;
 *     this.left = this.right = null;
 * }
 */
/**
 * @param {TreeNode} root
 * @param {number[][]} ops
 * @return {number}
 */
 var getNumber = function(root, ops) {
  const t = dfs(root)
  const n = t.length
  let red = []
  if(ops[0][0] === 1) {
    let l = lower_bound(t, x)
    let r = upper_bound(t, y)
    if(t[r] > y) r--
    red.push([l, r])
  }
  for(let i = 1; i<n; i++) {
    const [type, x, y] = ops[i]
    if(type === 0) {
      let temp = []
      for()
    } else {
      for()
    }
  }
  let ans = 0
  for(const [x, y] of red) {
    ans += y - x + 1
  }
  return ans
  function dfs(root, arr = []) {
    if(!root) {
      return arr
    }
    dfs(root.left, arr)
    arr.push(root.val)
    dfs(root.right, arr)
    return arr
  }
    // 在nums中查找第一个 > target的index
  function upper_bound (nums, target) {
    let l = 0, r = nums.length-1
    while(l < r){
      let m = Math.floor((l+r)/2)
      if(nums[m] > target){
        r = m
      }else{
        l = m+1
      }
    }
    return l
  }

  // 在nums中查找第一个 >= target的index
  function lower_bound (nums, target) {
    let l = 0, r = nums.length-1
    while(l < r){
      let m = Math.floor((l+r)/2)
      if(nums[m] >= target){
        r = m
      }else{
        l = m+1
      }
    }
    return l
  }
};